/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-11 06:41:09
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-12 20:58:03
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/screens/app/home_screen_backup.dart';
import 'package:flutter_data_center/screens/common/user_helper.dart';
import 'package:flutter_data_center/screens/login/login_screen.dart';
import 'package:flutter_data_center/utills/navigator_utils.dart';
import 'package:intro_views_flutter/intro_views_flutter.dart';

class GuideScreen extends StatelessWidget {
  // Making list of pages needed to pass in IntroViewsFlutter constructor.
  final pages = [
    PageViewModel(
      pageColor: const Color(0xFF03A9F4),
      // iconImageAssetPath: 'assets/air-hostess.png',
      bubble: Image.asset('assets/images/workout.png'),
      body: const Text(
        'Hassle-free  booking  of  flight  tickets  with  full  refund  on  cancellation',
      ),
      title: const Text(
        'Flights',
      ),
      titleTextStyle:
          const TextStyle(fontFamily: 'MyFont', color: Colors.white),
      bodyTextStyle: const TextStyle(fontFamily: 'MyFont', color: Colors.white),
      mainImage: Image.asset(
        'assets/images/bg1.jpg',
        fit: BoxFit.cover,
        alignment: Alignment.center,
      ),
    ),
    PageViewModel(
      pageColor: const Color(0xFF8BC34A),
      iconImageAssetPath: 'assets/images/cup.png',
      body: const Text(
        'We  work  for  the  comfort ,  enjoy  your  stay  at  our  beautiful  hotels',
      ),
      title: const Text('Hotels'),
      mainImage: Image.asset(
        'assets/splash/background.jpg',
        fit: BoxFit.cover,
        alignment: Alignment.center,
      ),
      titleTextStyle:
          const TextStyle(fontFamily: 'MyFont', color: Colors.white),
      bodyTextStyle: const TextStyle(fontFamily: 'MyFont', color: Colors.white),
    ),
    PageViewModel(
      pageBackground: Container(
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            stops: [0.0, 1.0],
            begin: FractionalOffset.topCenter,
            end: FractionalOffset.bottomCenter,
            tileMode: TileMode.repeated,
            colors: [
              Colors.orange,
              Colors.pinkAccent,
            ],
          ),
        ),
      ),
      iconImageAssetPath: 'assets/images/heart.png',
      body: const Text(
        'Easy  cab  booking  at  your  doorstep  with  cashless  payment  system',
      ),
      title: const Text('Cabs'),
      mainImage: Image.asset(
        'assets/splash/dark-background.jpg',
        fit: BoxFit.cover,
        alignment: Alignment.center,
      ),
      titleTextStyle:
          const TextStyle(fontFamily: 'MyFont', color: Colors.white),
      bodyTextStyle: const TextStyle(fontFamily: 'MyFont', color: Colors.white),
    ),
  ];
  @override
  Widget build(BuildContext context) {
    return IntroViewsFlutter(
      pages,
      showNextButton: true,
      showBackButton: true,
      onTapDoneButton: () {
        // Use Navigator.pushReplacement if you want to dispose the latest route
        // so the user will not be able to slide back to the Intro Views.
        if (UserHelper.getInstance.isLogin) {
          NavigatorUtils.pushPageByFade(
            context: context,
            targetPage: HomeScreen(),
            isReplace: true,
          );
        } else {
          NavigatorUtils.pushPageByFade(
            context: context,
            targetPage: LoginScreen(),
            isReplace: true,
          );
        }
      },
      onTapSkipButton: () {
        if (UserHelper.getInstance.isLogin) {
          NavigatorUtils.pushPageByFade(
            context: context,
            targetPage: HomeScreen(),
            isReplace: true,
          );
        } else {
          NavigatorUtils.pushPageByFade(
            context: context,
            targetPage: LoginScreen(),
            isReplace: true,
          );
        }
      },
      pageButtonTextStyles: const TextStyle(
        color: Colors.white,
        fontSize: 18.0,
      ),
    );
  }
}
